﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace TongHopBCTuan2014
{
    class dlieuhuyen
    {
        string filename = "dmhuyen.xml";
        public List<huyen> listHuyen()
        {
//            - <dmuchuyen>
//- <Huyen>
            XmlDocument xml = new XmlDocument();
            xml.Load(filename); // suppose that myXmlString contains "<Names>...</Names>"
            XmlNode nodeRoot = xml.LastChild;
            XmlNodeList xnList = nodeRoot.ChildNodes;
            List<huyen> lHuyen = new List<huyen>();
            foreach (XmlNode xn in xnList)
            {
                int x = xnList.Count;
                huyen iHuyen = new huyen();

              iHuyen.MaHuyen=  xn.FirstChild.InnerText;
              iHuyen.TenHuyen = xn.LastChild.InnerText;
              lHuyen.Add(iHuyen);
                // name = xn["name"].InnerText;
                // nameSoft = xn["nameSoft"].InnerText;
                // author = xn["author"].InnerText;
                // address = xn["address"].InnerText;
                //mobile = xn["mobile"].InnerText;
                // mail = xn["mail"].InnerText;

            }
            return lHuyen;
        }
    }
}
